<template>
  <div class="login">
    <div class="main">
      <page-head class="header_login" />
      <div class="main-inner">
        <div class="left-text-container">
          <div class="left-text">
            <p>国考云</p>
            <p>在线考试新选择</p>
            <div><span>了解详情 ></span></div>
          </div>
        </div>
        <div class="bd-container">
          <div class="bd">
            <div class="inner">
              <div class="title">企业管理员登录</div>
              <div class="mode">
                <el-button
                  :class="[mode === 'pwd' ? 'selected' : '']"
                  @click="changeMode('pwd')"
                  >密码登录</el-button
                >
                <el-button
                  :class="[mode === 'sms' ? 'selected' : '']"
                  @click="changeMode('sms')"
                  >验证码登录</el-button
                >
              </div>
              <component :is="component[mode]" />
              <div class="extra">
                <el-link type="primary" :underline="false"> 企业注册 </el-link>
                <el-link type="info" :underline="false"> 忘记密码？ </el-link>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import pageHead from "./components/Header.vue";
import pwd from "./components/pwd.vue";
import { ref } from "vue";
import { useLayout } from "@/layout/hooks/useLayout";
import { useDataThemeChange } from "@/layout/hooks/useDataThemeChange";
defineOptions({
  name: "myLogin"
});
// 主题布局
const { initStorage } = useLayout();
initStorage();
const { dataThemeChange } = useDataThemeChange();
dataThemeChange();

const mode = ref("pwd");
const changeMode = (str: string) => {
  mode.value = str;
};
const component = {
  pwd
};
</script>

<style lang="scss" scoped>
.login {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-height: 750px !important;
  overflow: auto;
  background: #f7f8fd url("../../assets/bg_1.jpg") no-repeat;
  background-size: 100% 100%;

  .main {
    position: relative;
    width: 100%;
    height: 100%;
    margin: 0 auto;

    .header_login {
      position: absolute;
      top: 0;
      left: 0;
    }

    .main-inner {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 100%;
      height: 100%;

      .left-text-container {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 50%;

        .left-text {
          line-height: 60px;

          p {
            font-size: 30px;
            letter-spacing: 0.5em;
          }

          div {
            color: red;
            letter-spacing: 0.2em;
            cursor: pointer;
          }
        }
      }

      .bd-container {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 50%;

        .bd {
          padding: 30px 60px;
          background: #fff;
          border-radius: 7px;
          box-shadow: 3px 3px 5px #888;

          .inner {
            width: 315px;
            margin: 0 auto;

            .success {
              height: 40vh;
            }
          }

          .el-form-item {
            white-space: nowrap;

            &:last-child {
              text-align: center;
            }
          }

          .title {
            padding: 0 0 15px;
            margin-bottom: 20px;
            font-size: 20px;
            font-weight: 300;
            text-align: center;
          }

          .mode {
            display: flex;
            justify-content: space-between;
            margin: 20px 0 30px;

            .el-button {
              padding-right: 45px;
              padding-left: 45px;
              border: 1px solid transparent;

              &:hover,
              &:focus {
                background: #fff;
                border: 1px solid #e06563;
              }
            }

            .selected {
              color: #e06563;
              background: #fff;
              border: 1px solid #e06563;
            }
          }

          .verification {
            .dot,
            .el-icon-success {
              position: absolute;
              top: 50%;
              left: 20px;
              display: block;
              width: 10px;
              height: 10px;
              background: #e06563;
              border-radius: 100px;
              transform: translateY(-50%);
            }

            .el-icon-success {
              color: #e06563;
              background: none;
              transform: translateY(calc(-50% + -2px));
            }
          }

          .el-button {
            margin-left: 0;
          }

          .extra {
            position: relative;
            text-align: center;

            .el-link {
              &:nth-child(2) {
                position: absolute;
                right: 0;
                font-size: 12px;
              }
            }
          }
        }
      }
    }
  }
}

:deep(.el-input__count) {
  height: 30px;
}

@media screen and (width <= 1600px) {
  .left-text {
    left: 15% !important;
  }

  .bd {
    right: 15% !important;
  }
}

.feed-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 0;
  font-size: 20px;
  line-height: 50px;
  letter-spacing: 0.1em;
}

#sc {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 !important;
}

.imageCode {
  vertical-align: middle;
  cursor: pointer;
}

:deep(.el-input__inner) {
  font-weight: 700;
  color: #333 !important;
}

:deep(.el-input-group__append) {
  background: white;
}
</style>
